package com.hzz.mybatisplusdemo.userprofile.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 用户配置（暂时是声音和弹窗）
 * @TableName com.hzz.mybatisplusdemo.userprofile
 */
@TableName(value = "userprofile")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Userprofile implements Serializable {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 用户id
     */
    @TableField(value = "ownerId")
    private Integer ownerId;

    /**
     * 是否报警声音
     */
    @TableField(value = "isvoice")
    private Boolean isvoice;

    /**
     * 是否弹窗
     */
    @TableField(value = "iswindow")
    private Boolean iswindow;

    /**
     * 一次更新个数
     */
    @TableField(value = "updateNum")
    private Integer updateNum;

    /**
     * 报警查看总数
     */
    @TableField(value = "alarmNum")
    private Integer alarmNum;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Userprofile other = (Userprofile) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getOwnerId() == null ? other.getOwnerId() == null : this.getOwnerId().equals(other.getOwnerId()))
            && (this.getIsvoice() == null ? other.getIsvoice() == null : this.getIsvoice().equals(other.getIsvoice()))
            && (this.getIswindow() == null ? other.getIswindow() == null : this.getIswindow().equals(other.getIswindow()))
            && (this.getUpdateNum() == null ? other.getUpdateNum() == null : this.getUpdateNum().equals(other.getUpdateNum()))
            && (this.getAlarmNum() == null ? other.getAlarmNum() == null : this.getAlarmNum().equals(other.getAlarmNum()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getOwnerId() == null) ? 0 : getOwnerId().hashCode());
        result = prime * result + ((getIsvoice() == null) ? 0 : getIsvoice().hashCode());
        result = prime * result + ((getIswindow() == null) ? 0 : getIswindow().hashCode());
        result = prime * result + ((getUpdateNum() == null) ? 0 : getUpdateNum().hashCode());
        result = prime * result + ((getAlarmNum() == null) ? 0 : getAlarmNum().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", ownerId=").append(ownerId);
        sb.append(", isvoice=").append(isvoice);
        sb.append(", iswindow=").append(iswindow);
        sb.append(", updateNum=").append(updateNum);
        sb.append(", alarmNum=").append(alarmNum);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}